package org.appfuse.webapp.util;

import java.util.List;

import org.appfuse.model.Criteria;
import org.appfuse.service.CriteriaManager;
import org.appfuse.webapp.form.CriteriaForm;

public class CriteriaUtil {
	public static boolean isTopCriteria(Criteria criteria) {
		if (criteria == null) {
			return false;
		}

		return criteria.getCriteriaNumber().endsWith("000000");
	}

	public static boolean isLeafCriteria(Criteria criteria) {
		if (criteria == null || criteria.getCriteriaNumber() == null) {
			return true;
		}

		return !criteria.getCriteriaNumber().endsWith("00");
	}

	public static boolean isLeafCriteria(CriteriaForm criteriaForm) {
		if (criteriaForm == null || criteriaForm.getCriteriaNumber() == null) {
			return true;
		}
		return !criteriaForm.getCriteriaNumber().endsWith("00");
	}

}
